package barrel_kong;


import kong_gui_items.Display;

public class ScenarioState {

	boolean dialogScreenHidden = false;
	boolean positionSet = false;
	boolean angleSet = false;
	boolean powerSet = false;
	boolean pressureDetected = false;
	boolean anwserDetected = false;
	boolean monkeyShot = false;
	boolean anwserTimeIsOver = false;
	boolean levelFinished = false;
	
	Double errorRate = 0.0;

	int diviseur = 1;
	int dividande = 1;

	String wordHeard="";
	int numberHeard = 0; 
	String currentQuestionText="";

	Display display;


	public ScenarioState(final Display display)
	{
		this.display = display;

		new Thread(){@Override
		public void run(){try {

			display.setMessage(mes_Welcom);
			Thread.sleep(7000);
			display.setMessage(mes_Move_Slider);
		}
		catch (InterruptedException e) {e.printStackTrace();}}}.start();
	}

	String mes_Welcom = "You are in the barrel. You need to reach the DK barrel.";
	String mes_Move_Slider = "Use the slider to move barrel and the rotation sensor to set the angle. Then use the voice to set the power. Validate power by pressing the blue button, catch a maximum of bananas!";




	//Getters
	public boolean isPositionSet()		{ return positionSet;}
	public boolean isAngleSet() 		{ return angleSet;}
	public boolean isPowerSet() 		{ return powerSet;}
	public boolean isPressureDetected() { return pressureDetected;}
	public boolean isAnwserDetected() 	{ return anwserDetected;}
	public boolean isMonkeyShot() 		{ return monkeyShot;}
	public boolean isDialogScreenHidden(){return dialogScreenHidden;}
	public boolean isLevelFinished() 	{ return levelFinished;}
	
	//Setters
	public void setPositionSet(boolean positionSet) {
		this.positionSet = positionSet;
	}

	public void setAngleSet(boolean angleSet) {
		this.angleSet = angleSet;
	}

	public void setPowerSet(boolean powerSet) {
		this.powerSet = powerSet;
	}

	public void setPressureDetected(boolean pressureDetected) {

		this.pressureDetected = pressureDetected;
	}

	public void setLevelFinished(boolean status){ this.levelFinished = status;}
	
	public void setMonkeyShot(boolean monkeyShot) {
		this.monkeyShot = monkeyShot;
	
	}

	public void setDialogScreenHidden(boolean dialogScreenHidden) {
		this.dialogScreenHidden = dialogScreenHidden;
	}


	public void resetScenario() {
		this.positionSet = false;
		this.angleSet = false;
		this.powerSet = false;
		this.pressureDetected = false;
		this.anwserDetected = false;
		this.monkeyShot = false;
		// only needet at false for the launching of application.
		this.dialogScreenHidden = true;
		this.anwserTimeIsOver = false;
		this.wordHeard = "";
		this.errorRate = 0.0;

		wordHeard="";
		numberHeard = 0; 
		
	}
	
	public void resetGameAfterGO(final Display display)
	{
		dialogScreenHidden = false;
		levelFinished = false;
		this.display = display;
		new Thread(){@Override
		public void run(){try {

			display.setMessage(mes_Welcom);
			Thread.sleep(7000);
			display.setMessage(mes_Move_Slider);
		}
		catch (InterruptedException e) {e.printStackTrace();}}}.start();
		
	}
	public boolean isTimeOver() {
		return anwserTimeIsOver;
	}
	public double getErrorRate() {
		return errorRate;
	}
	
}
